import request from '@/utils/request'

// 查询订单列表
export function listOrder(query) {
  return request({
    url: '/greenold-order/order/list',
    method: 'get',
    params: query
  })
}

// 查询订单详细
export function getOrder(id) {
  return request({
    url: '/greenold-order/order/' + id,
    method: 'get'
  })
}

// 新增订单
export function addOrder(data) {
  return request({
    url: '/greenold-order/order',
    method: 'post',
    data: data
  })
}

// 修改订单
export function updateOrder(data) {
  return request({
    url: '/greenold-order/order',
    method: 'put',
    data: data
  })
}

// 删除订单
export function delOrder(id) {
  return request({
    url: '/greenold-order/order/' + id,
    method: 'delete'
  })
}
/** 取消订单 */
export function cancelOrder(data) {
  return request({
    url: '/greenold-order/order/cancel', // 后端取消订单接口地址
    method: 'post',
    data: data // 传递订单ID和取消原因
  });
}

export function refundOrder(data) {
   return request({
     url: '/greenold-order/order/refund', // 后端退款订单接口地址
     method: 'post',
     data: data // 传递订单ID和退款原因等
   });
}
export function listAll(query) {
  return request({
    url: '/greenold-order/order/listall',
    method: 'get',
    params: query
  })
}


